package com.onemileshop.updater;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;

public class AppUpdater 
{
   Context context;
  
   public AppUpdater(Context _context)
   {
	  context=_context;
   }
   
   private String GetAppVersion()
   {
	  try
	  {
		 PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
		 return info.versionName;
	  }
	  catch (NameNotFoundException e)
	  {
		  
		e.printStackTrace();
	  }
	  return null;
   }

   public void UpdateApp()
   {
	  TaskCheckVersion taskCheckVersion=new TaskCheckVersion(GetAppVersion(),context);
	  taskCheckVersion.execute((Void)null);
   }
}
  